#include <stdio.h>
#define MAX 120

int main(void) {
	int arr[MAX];
	int i = 0;
	scanf("%d", &arr[i]);
	while (arr[i] != 0) {
		i++;
		scanf("%d", &arr[i]);
	}
	for (int j = i - 1; j >= 0; j--) {
		printf("%d ", arr[j]);
	}

	return 0;
}